import java.util.Arrays;
import java.util.Scanner;

public class HomeWork1 {
    public static void main(String[] args) {
        int[] jihe=new int[]{};
        jihe=add();
        System.out.println(Arrays.toString(jihe));
        int geshu=jihe.length;
        int l=2;
        if(geshu>=4){
            l=panduan(jihe,geshu);
            if(l==1){
                System.out.println("有四个相等的数");
            }else{
                System.out.println("没有四个相等的数");
            }
        }else{
            System.out.println("数组个数小于四个");
        }
    }
    public static int[] add(){
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入个数:");
        int geshu=sc.nextInt();
        int[] shuzu=new int[geshu];
        for(int i=0;i<geshu;i++){
            shuzu[i]=sc.nextInt();
        }
        return shuzu;
    }

    public static int panduan(int[] jihe,int geshu){
        int biaoji=1,s=jihe[0];
        for(int i=1;i<geshu;i++){
            if(jihe[i]==s)
            {
                biaoji++;
            }else{
                biaoji=1;
                s=jihe[i];
            }
            if(biaoji==4){
                return 1;
            }
        }
        return 0;
    }
}
